# -*- coding: utf-8 -*-
# @Time    : 2024/9/5 下午4:55
# @Author  : liujun
# @Email   : 2592730854@qq.com
# @File    : utils.py
# @Software: PyCharm

import json

from appium import webdriver
from appium.options.android import UiAutomator2Options


def open_xiachufang(desired_capabilities=None):
    desired_capabilities = {
                'platformName':'Android',
                # 'deviceName':'8DJZGU8LWOBI6PRO',
                'deviceName': '8DJZGU8LWOBI6PRO',
                'platformVersion':'14',
                # 'platformVersion': '7.1.2',
                'appPackage':"com.xiachufang",
                # 'appActivity':'com.xiachufang.activity.home.HomeActivity',
                'appActivity':'com.xiachufang.startpage.ui.StartPageActivity',
                'noReset':True
            }
    # print(json.dumps(desired_capabilities))
    options = UiAutomator2Options().load_capabilities(desired_capabilities)
    driver =webdriver.Remote('http://localhost:4723/wd/hub',options=options)
    return driver
# open_xiachufang()


